package Iterator;

import com.sun.deploy.util.Waiter;

import java.util.Iterator;

public class Client {
    public void print(){
        System.out.println("===========汉堡菜单==========");
        PancakeHouseShop pancakeHouseShop=new PancakeHouseShop();
        Iterator pancakeHouseMenuIterator=pancakeHouseShop.createIterator();
        printMenu(pancakeHouseMenuIterator);
        System.out.println("===========晚餐菜单==================");
        DinnerShop dinnerShop=new DinnerShop();
        Iterator dinnerMenuIterator=dinnerShop.createIterator();
        printMenu(dinnerMenuIterator);
    }
    private void printMenu(Iterator iterator){
        while(iterator.hasNext()){
            Menu menu=(Menu) iterator.next();
            System.out.println("名称"+menu.getName()+"==========价格："+menu.getPrice());
        }
    }

    public static void main(String[] args) {
        Client client=new Client();
        client.print();
    }
}
